<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta http-equiv="X-UA-Compatible" content="IE=8">
		<title>新闻 </title>
		<link rel="stylesheet" href="../../bootstrap/css/bootstrap.min.css">
		<link rel="stylesheet" href="../../layui/css/layui.css">
		<link rel="stylesheet" href="../../css/swiper.min.css">
		<link rel="stylesheet" href="../../css/common.css">
		<link rel="stylesheet" href="../../css/default.css">
		<link rel="stylesheet" href="../../css/style.css">

		<!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
		<!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js?version=1.01"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js?version=1.01"></script>
    <![endif]-->

	</head>

	<body>

		<!--头部-->
		<div class="layui-fluid">
			<div class="top_header_wrap"></div>
			<!--广告-->
			<div class="banner">
				<div class="swiper-container swiper-container1">
					<div class="swiper-wrapper">
						<div class="swiper-slide"><img src="../../img/banner02.png"></div>
						<div class="swiper-slide"><img src="../../img/banner01.png"></div>
						<div class="swiper-slide"><img src="../../img/banner03.png"></div>
					</div>
					<!-- Add Pagination -->
					<div class="swiper-pagination"></div>
				</div>
			</div>
			<!--内容-->
			<div class="main_container">
				<div class="layui-container">
					<div class="brumb_box">
						招生计划>高考新闻>>新闻列表
					</div>
					<div class="news_list" id="news_list">
						<div class="layui-row news_list_item">
							<div class="layui-col-lg2 layui-col-md2 layui-col-sm2 layui-col-xs3">
								<div class="new_left_col">
									<h2>21</h2>
									<span>2018年5月</span>
									<strong>星期天</strong>
								</div>
							</div>
							<div class="layui-col-lg10 layui-col-md10 layui-col-sm10 layui-col-xs9">
								<div class="news_right_col">
									<div class="layui-col-lg12">
										<h3>西安交通大学预扩招100名新生</h3>
									</div>
									<div class="layui-col-lg12">
										<p>教育，教育者按照法律法规和行业规范，根据学校条件和职称，有目的有计划有组织的对受教育者的心智发展进行教化培育，以现有的经验、学识推敲于人，为其解释各种现象、问题或行为，以提高实践能力…</p>
									</div>
								</div>
							</div>
						</div>
						<div class="layui-row news_list_item">
							<div class="layui-col-lg2 layui-col-md2 layui-col-sm2 layui-col-xs3">
								<div class="new_left_col">
									<h2>21</h2>
									<span>2018年5月</span>
									<strong>星期天</strong>
								</div>
							</div>
							<div class="layui-col-lg10 layui-col-md10 layui-col-sm10 layui-col-xs9">
								<div class="news_right_col">
									<div class="layui-col-lg12">
										<h3>西安交通大学预扩招100名新生</h3>
									</div>
									<div class="layui-col-lg12">
										<p>教育，教育者按照法律法规和行业规范，根据学校条件和职称，有目的有计划有组织的对受教育者的心智发展进行教化培育，以现有的经验、学识推敲于人，为其解释各种现象、问题或行为，以提高实践能力…</p>
									</div>
								</div>
							</div>
						</div>

					</div>
					<div id="page" class="pagnition">
						<ul class="clearfix">
							<li class="before_btn"></li>
							<li>
								<a href="javascript:void(0);"><i class="before_dot">.....</i></a>
							</li>
							<li>
								<a id='currPage0' href="javascript:void(0);" class="speifyPage active">1</a>
							</li>
							<li>
								<a id='currPage' href="javascript:void(0);" class="speifyPage">2</a>
							</li>
							<li>
								<a id='currPage1' href="javascript:void(0);" class="speifyPage">3</a>
							</li>
							<li>
								<a href="javascript:void(0);"><i class="after_dot">.....</i></a>
							</li>
							<li class="after_btn">

							</li>
						</ul>
					</div>
				</div>

			</div>
			<!--尾部-->
			<div class="footer_container">

			</div>
		</div>
	</body>
	<script type="text/javascript" src="../../js/jquery-1.11.0.min.js"></script>
	<script type="text/javascript" src="../../js/define.js"></script>

	<script type="text/javascript" src="../../layui/layui.js"></script>
	<script type="text/javascript" src="../../js/swiper.min.js"></script>
	<script type="text/javascript" src="../../js/swiper.js"></script>
	<script type="text/javascript" src="../../bootstrap/js/bootstrap.min.js"></script>
	<script>
		var currPage = 1;
		var totalPage = 1;

		function getData(thisPage) {
			$.ajax({
				type: "get",
				url: "http://47.111.188.27:8080/gsgkzyl/dynamic/news/list/" + thisPage + "/3/2/%E6%8A%A5%E8%80%83%E7%AE%80%E8%AE%AF",
				success: function(l) {
					$('#news_list').empty();
					var data = l.data.list;
					if(data != null && data != "" && data != "{}" && data != "[]") {
						for(var i = 0; i < data.length; i++) {
							var newsHtml = '';
							newsHtml += '<a href="news_detail.html?id=' + data[i].id + '">';
							newsHtml += '<div class="layui-row news_list_item">';
							newsHtml += '<div class="layui-col-lg2 layui-col-md2 layui-col-sm2 layui-col-xs2">';
							newsHtml += '<div class="new_left_col">';
							//newsHtml += '<h2>21</h2>';
							newsHtml += '<span>' + data[i].publish_time + '</span>';
							newsHtml += '<strong></strong>';
							newsHtml += '</div>';
							newsHtml += '</div>';
							newsHtml += '<div class="layui-col-lg10 layui-col-md10 layui-col-sm10 layui-col-xs10">';
							newsHtml += '<div class="news_right_col">';
							newsHtml += '<div class="layui-col-lg12">';
							newsHtml += '<h3>' + data[i].title + '</h3>';
							newsHtml += '</div>';
							newsHtml += '<div class="layui-col-lg12">';
							newsHtml += '<p>' + data[i].detail + '</p>';
							newsHtml += '</div>';
							newsHtml += '</div>';
							newsHtml += '</div>';
							newsHtml += '</div>';
							newsHtml += '</a>';
							$('#news_list').append(newsHtml);
						}
						currPage = l.data.currPage;
						totalPage = l.data.totalPage;
						
						$('.before_dot').hide();
						$('.after_dot').hide();
						if(currPage>2){
							$('.before_dot').show();
						}
						if(currPage<totalPage-2){
							$('.after_dot').show();
						}
						
						$('.speifyPage').removeClass('active');
						var html = "";
						if(currPage>1){
							$("#currPage0").html(currPage -1);
						}else{
							$("#currPage0").html(currPage);
							$("#currPage0").addClass("active")
							if(totalPage >= 2){
								$("#currPage").html(currPage + 1 );
							}
							if(totalPage >= 3){
								$("#currPage1").html(currPage + 2 );
							}
							return;
						}
						$("#currPage").html(currPage );
						$("#currPage").addClass("active");
						if(currPage<totalPage){
							$("#currPage1").html(currPage +1 );
						}else{
							$('.speifyPage').removeClass('active');
							$("#currPage1").html(currPage);
							$("#currPage1").addClass("active")
							if(totalPage >= 2){
								$("#currPage").html(currPage - 1 );
							}
							if(totalPage >= 3){
								$("#currPage0").html(currPage - 2 );
							}
						}
						
					} else {
						$('#news_list').html('暂无数据');
						$('.pagnition').hide();
					}
				}
			})

		}
		$(document).ready(function() {

			$(".top_header_wrap").load("../common/header.html");
			$(".footer_container").load("../common/footer.html");
			getData(1);

			$(".before_btn").click(function() {
				if(currPage == 1)
					return;
				getData(currPage - 1);
			})
			$(".after_btn").click(function() {
				if(currPage == totalPage)
					return;
				getData(currPage + 1);
			})
			$(".speifyPage").click(function() {
				var index = $(this).html();
				getData(index);
			})
		});

		//var searchKeywords = $('#search_input').val();
	</script>

</html>